<?php

namespace backend\helpers;

use yii\helpers\ArrayHelper;
use yii\helpers\Html;

class IsHiddenFlagHelper
{
    const HIDDEN = 1;
    const VISIBLE = 0; 

    public static function statusList()
    {
        return [
            self::HIDDEN => 'Скрыт',
            self::VISIBLE => 'Опубликован',
        ];
    }

    public static function statusName($status)
    {
        return ArrayHelper::getValue(self::statusList(), $status);
    }

    public static function statusLabel($status)
    {
        switch ($status) {
            case self::HIDDEN:
                $class = 'label label-danger';
                break;
            case self::VISIBLE:
                $class = 'label label-success';
                break;
            default:
                $class = 'label label-default';
        }

        return Html::tag('span', ArrayHelper::getValue(self::statusList(), $status), [
            'class' => $class,
        ]);
    }
}